<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>编辑管理员 - 管理后台</title>
    <link rel="stylesheet" href="/static/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/public.css?s=0.01" media="all"/>
</head>
<body class="childrenBody">
<form class="layui-form " action="" method="post">
    <input name="admin_id" value="{$info['admin_id']}" type="hidden">
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">账号</label>
        <div class="layui-input-inline">
            <input name="username" value="{$info['username']}" lay-verify="required" class="layui-input" type="text">
        </div>
        <div class="layui-form-mid layui-word-aux">必填</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">密码</label>
        <div class="layui-input-inline">
            <input name="password" value="" placeholder="" class="layui-input" type="password">
        </div>
        <div class="layui-form-mid layui-word-aux">不修改勿填</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">昵称</label>
        <div class="layui-input-inline">
            <input name="nickname" value="{$info['nickname']}" lay-verify="required" class="layui-input" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">类型</label>
        <div class="layui-input-inline">
            <select name="type">
                <option value="1" {if condition="$info['type'] == 1"}selected{/if}>管理员</option>
                <option value="2" {if condition="$info['type'] == 2"}selected{/if}>业务员</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:120px;">启用</label>
        <div class="layui-input-block">
            <input type="checkbox" name="status" value="1" lay-skin="switch" {if condition="$info['status'] == 1"}checked{/if} lay-text="是|否">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">&nbsp;</label>
        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="demo1">提交保存</button>
    </div>
</form>
<script src="/static/layui.js"></script>
<script>
    layui.use(['element', 'jquery', 'layer', 'form'], function () {
        var element = layui.element, layer = layui.layer, form = layui.form, $ = layui.$;
        form.on('submit(demo1)', function (data) {
            var index = layer.load(1);
            $.post('{:url("admin/editAdmin")}', data.field, function (data) {
                if (data.code == 0) {
                    layer.close(index);
                    layer.msg(data.msg, {
                        time: 3000,
                        icon: 1
                    }, function () {
                        parent.layer.closeAll("iframe");
                        parent.layui.tableIns.reload();
                    });
                } else {
                    layer.close(index);
                    layer.msg(data.msg, {icon: 5, shift: 6});
                }
            });
            return false;
        });
    });
</script>
</body>
</html>